<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $task_id 主任务ID
 * @property int $scheme_id 方案ID
 * @property int $robot_id 机器人
 * @property string $day 发送日期
 * @property array $content 发送内容
 * @property int $contact_count 受众数量
 * @property int $completed_count 已处理数量
 * @property int $status 0=创建中 1=等待中 2=发送中 3=已完成 4=暂停中 5=已取消
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property-read null|ChSmartPushScheme $scheme 
 * @property-read null|ChRobot $robot 
 */
class ChSmartPushSchemeSubTask extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_smart_push_scheme_sub_task';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'task_id', 'scheme_id', 'robot_id', 'day', 'content', 'contact_count', 'completed_count', 'status', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'task_id' => 'integer', 'scheme_id' => 'integer', 'robot_id' => 'integer', 'content' => 'array', 'contact_count' => 'integer', 'completed_count' => 'integer', 'status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function scheme(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ChSmartPushScheme::class, 'id', 'scheme_id');
    }

    public function robot()
    {
        return $this->hasOne(ChRobot::class,'id','robot_id');
    }
}
